package core.component.auth;


import com.distribute.pojo.LoginInfo;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 登录信息存储器
 */
public class LoginInfoHolder {

    private static final Map<String, LoginInfo> LOGIN_INFO_MAP = new ConcurrentHashMap<>();

    public static LoginInfo getInstance(String username) {
        if(username == null || username.isEmpty()){
            return null;
        }else {
            return LOGIN_INFO_MAP.computeIfAbsent(username, k -> new LoginInfo());
        }
    }
}
